class Scene {
  constructor(game) {
    this.game = game
    this.elements = []
  }

  update() {
    this.elements.forEach(elem => {
      elem.update && elem.update(this.game.context)
    })
  }

  draw() {
    this.elements.forEach(elem => {
      elem.draw && elem.draw(this.game.context)
    })
  }

  add(elem) {
    this.elements.push(elem)
  }

  remove(elem) {
    let index = this.elements.indexOf(elem)
    if (index > -1) {
      this.elements.splice(index, 1)
    }
  }
}